<!--信息安全-统计分析-金库审批管理违规情况统计表-->
<template>
  <div :class="isScroll?'rank-chest-table':''">
    <span class="table-title">金库审批管理违规情况统计表</span>
    <el-table border
              :data="tableData"
              :height="tableHeight">
      <el-table-column prop="rn"
                       label="排名"
                       width="50"
                       align="center"
                       :formatter="formatRn"></el-table-column>
      <el-table-column prop="prvdName"
                       label="公司"
                       align="center"
                       min-width="80"></el-table-column>
      <el-table-column v-show="prvdId!==10000"
                       prop="cityName"
                       label="地市/省部门"
                       align="center"
                       min-width="80"></el-table-column>
      <el-table-column prop="senRecNum"
                       label="涉敏操作日志数量（条）D"
                       align="center"
                       min-width="80"
                       sortable
                       :formatter="formatNum"></el-table-column>
      <el-table-column prop="notVauRecNum"
                       label="未经金库审批日志数量（条）E"
                       align="center"
                       min-width="80"
                       sortable
                       :formatter="formatNum"></el-table-column>
      <el-table-column prop="notValRecPer"
                       label="未经金库审批日志数量占比E/D%"
                       align="center"
                       min-width="100"
                       sortable
                       :formatter="formatPer"></el-table-column>
      <el-table-column prop="vauFacRecNum"
                       label="金库审批人为厂商人员的日志数量(条）"
                       align="center"
                       min-width="80"
                       sortable
                       :formatter="formatNum"></el-table-column>
      <el-table-column prop="senRecNum"
                       label="涉敏操作超出授权时段的日志数量（条）
I=K+L"
                       align="center"
                       min-width="80"
                       :formatter="formatNum"
                       sortable></el-table-column>
      <el-table-column prop="senRecPer"
                       label="涉敏操作超出授权时段的日志数量占比I/D%"
                       align="center"
                       min-width="80"
                       sortable
                       :formatter="formatPer"></el-table-column>
      <el-table-column prop="timeRecNum"
                       label="操作开始时间不在授权时段范围内的日志数量（条）K"
                       align="center"
                       min-width="80"
                       sortable
                       :formatter="formatPer"></el-table-column>
      <el-table-column prop="timeOverRecNum"
                       label="操作开始时间晚于授权开始时间3小时以后的日志数量（条）L"
                       align="center"
                       min-width="80"
                       sortable
                       :formatter="formatNum"></el-table-column>
    </el-table>
  </div>
</template>
<script>
import { mapState, mapActions, mapMutations } from "vuex";
import SubTableMixin from "@/components/SubjectPage/mixins/SubTable";
export default {
  name: "VaultRankTab",
  mixins: [SubTableMixin],
  data() {
    return {
      // 表格数据
      tableData: null,
      clientWidth: document.body.clientWidth,
      isScroll: false
    };
  },
  computed: mapState({
    tableHeight: state => state.contentHeight - 316, // table内容高度
    prvdId: state => state.subject.prvdId, // 省公司id
    audTrm: state => state.subject.audTrm, // 审计月
    flagId: state => state.khxxaq.flagId // 域id
  }),
  watch: {
    prvdId(newVal, oldVal) {
      this.loadTableData();
    },
    audTrm(newVal, oldVal) {
      this.loadTableData();
    },
    concern(newVal, oldVal) {
      this.loadTableData();
    },
    flagId(newVal, oldVal) {
      this.loadTableData();
    }
  },
  created() {
    if (this.clientWidth === 1280) {
      this.isScroll = true;
    } else {
      this.isScroll = false;
    }
  },
  mounted() {
    this.loadTableData();
  },
  methods: {
    // 查询结果
    loadTableData() {
      // 获取表格数据
      this.$api.khxxaq
        .getVaultRankData({
          prvdId: this.prvdId,
          audTrm: this.audTrm,
          concern: this.concern,
          flagId: this.flagId
        })
        .then(res => {
          // 表格数据初始化
          this.tableData = res.tableData;
        })
        .catch(err => {
          this.$message.error(err);
        });
      this.logRecord(
        "审计专题",
        "客户信息安全管理违规",
        "金库审批管理违规情况统计表",
        "查询"
      );
    },
    formatRn(state) {
      return state.rn === 0 ? "-" : state.rn;
    }
  }
};
</script>
<style lang="scss" scoped>
.rank-chest-table {
  /deep/.el-table th.gutter {
    display: block !important;
    width: 17px !important;
  }
}
.table-title {
  text-align: center;
  display: block;
  color: #fff;
  font-size: 16px;
  margin-bottom: 10px;
}
</style>


